<?php
//字符集
header("content-type:text/html;charset=utf-8;");

//连接增删改查数据库
include './login_CRUD.php';

//连接mysql
$coon = connectDB('127.0.0.1','root','qq553408','test2106');

//通过POST书id和用户名
$username = $_GET["username"];

//查询 书架是否有书
$sql = "SELECT *FROM books WHERE `username` = '$username'"; 
$res = mysqli_query($coon,$sql);

if($res -> num_rows > 0){
    $arr = array();
    while($row = $res->fetch_assoc()){
        array_push($arr,$row);
    }
    print_r(json_encode($arr));
}else{
    print_r(json_encode(0));
}

?>